<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Class_type extends Model
{
	public $timestamps = false;
    protected $fillable = [
        'name', 'description',
    ];

    public function squad()
    {
        return $this->belongsTo(Squad::class);
    }

    //0啥都不做，1，插入['0'=>'请选择'],2.插入['0'=>'全部']
    public static function options($type = 0){
        $data = Class_type::all()->pluck('name','id')->toArray();

        if($type == 1){
            array_unshift($data,'请选择');
        }elseif($type == 2){
            array_unshift($data,'全部');
        }
        return $data;
    }
}
